{% extends 'index.html' %}

{% block css-javascript-agregados %}
    <!-- JQUERY-MULTISELECT -->
    <link 	type="text/css" 		href="static/css/jquery.multiselect.css" 			rel="stylesheet" />
    <script type="text/javascript" 	src="static/js/jquery.multiselect.js">				</script>
    <!-- JQUERY-MULTISELECT-FILTER -->
    <link 	type="text/css" 		href="static/css/jquery.multiselect.filter.css" 	rel="stylesheet" />
    <script type="text/javascript" 	src="static/js/jquery.multiselect.filter.js">		</script>
    <!-- SEXYSELECT -->
    <link 	type="text/css" 		href="static/ui.sexyselect/css/ui.sexyselect.0.55.css" 			rel="stylesheet"/>
    <script type="text/javascript" 	src="static/ui.sexyselect/js/ui.sexyselect.min.0.6.js" >		</script>
{% endblock %}

{% block heading_content%}Perfil de {{user.first_name}} {{user.last_name}}{% endblock%}

{% block content %}
    <br/>
    <div id="tab">

        <form  method="POST" action="/comunidadcyt/accounts/editNameMail/">
            {% csrf_token %}

            <table>
                {{ form2.as_table }}
            </table>
            <br/>
            <table>
                <input type="submit" class="find_link" value="Guardar" />
        </form>

        <br>
        <hr/>
        <br>

        <form  method="POST" enctype="multipart/form-data">
            {% csrf_token %}

            <table>
                {{ form.as_table }}
            </table>
            <br/>
<table>
            <input type="submit" class="find_link" value="Guardar" />
        </form>
        <form action="/comunidadcyt/accounts/profileSummary/" method="GET">
            <input type="submit" class="find_link" value="Cancelar" />
        </form>
        </tr>
</table>
    </div>

    <script type="text/javascript">
        $("#tab").tabs();
        $("#id_Fecha_creacion").datepicker();
    </script>

    <script type="text/javascript">
        $(document).ready(function(){
            $("#sin_cambio").button();
            $("#id_cargo").sexyselect({ title: 'Elegir cargo...',
                allowInput: true,
                allowFilter: true,
                allowDelete: false,
                selectionMode: 'multiple',
                onitemcreating: function(){
                    $.post("/comunidadcyt/cargos/create/xhr/",
                            {cargo:$("#id_cargo_addText").val()},
                            function (data)
                            {
                                if (data.ok != true)
                                {
                                    $("#id_cargo").sexyselect('showError',data.errors,2500);
                                    $("#id_cargo option[value='"+data.cargo+"']").remove();
                                }
                                else
                                {
                                    //location.reload(true);
                                    $("#id_cargo option[value='"+data.cargo+"']").remove();
                                    $("#id_cargo").append(new Option(data.cargo, data.id));
                                }
                            },
                            "json"
                    );
                }
            });

        });
    </script>
{%endblock%}


